<%@ page contentType="text/html;charset=utf-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<html>
	<head>
		<title>页面标题</title>
		<%@ include file="/commons/meta.jsp"%>
		<script language=javascript src="${ctx}/scripts/date/wpCalendar.js"></script>
		<script language="JavaScript" src="${ctx}/scripts/home/common.js"></script>
		<script type="text/javascript">
			/*增删改查以外的方法在下面添加，在按钮的onclick方法调用otherAction(method, actionPath)*/
			function otherAction(method, actionPath){
				var entityIds = document.getElementById("entityIds");
				var checkNum = document.getElementById("checkNum"); 
				var id = entityIds.value;
				if(id != ""){id = id.substring(0, id.length - 1);}
				var state = "";
				var url = "";
				
				if(checkNum.value=='1')
				{
				   state=document.getElementById(id+"-type").value;
				   url = document.getElementById(id+"-url").value;
				}
				//添加你的方法
				if(method == "view"){
					if(id == "") {alert("请选择记录!");return false;}
					if(checkNum.value != "1") {alert("请只选择一条记录!");return false;}
					if(state=='0')   //待阅
					   this.location="${ctx}" +url+ "&reback=2&backlogId="+id;
					else    //待办
					   this.location="${ctx}"+url +"&reback=2&backlogId="+id;
				}
			}
			
			function submitInfo(){
				var startdate = document.forms[0].elements("s_Date").value;
				var enddate = document.forms[0].elements("e_Date").value;
				if(!dateCompare(startdate,enddate)){
					alert("结束日期不能小于开始日期！");
					return;
				}
				document.forms[0].submit();
			}
			
			function dateCompare(startdate,enddate){   
				var arr=startdate.split("-");    
				var starttime=new Date(arr[0],arr[1],arr[2]);    
				var starttimes=starttime.getTime();   
				
				var arrs=enddate.split("-");    
				var lktime=new Date(arrs[0],arrs[1],arrs[2]);    
				var lktimes=lktime.getTime();   
  
				if(starttimes>lktimes){   
					return false;   
				} else {
					return true; 
				}
			}  
		</script>
	</head>
	<body>
		<!--统一信息中部右边开始-->
		<div class="listrt">
			<!--位置-->
			<div class="listat">
				您当前所在的位置:我的办公桌 ${urlName1} ${urlName2}
			</div>
			<!--搜索-->
			<div class="listsch">
				<ul>
					<li>
						<img src="${templateVo.styleImagePath}/mid1.gif" />
					</li>
					<li style="padding-left: 6px;">
						搜索
					</li>
					<li style="float: right;">
						<img src="${templateVo.styleImagePath}/mid3.gif" />
					</li>
					<li class="tag" style="float: right;">
						<img src="${templateVo.styleImagePath}/tag10.gif"
							onclick="dispSearchDiv(this)" />
						&nbsp;
					</li>
				</ul>
			</div>
			<div class="listbox">
				<ul>
					<li>
						<table width="98%" border="0" align="left" cellpadding="0"
							cellspacing="0" id="searchDiv">
							<html:form action="/BacklogAction.do">
								<input type="hidden" name="method" value="list" />
								<html:hidden property="entityIds" />
								<html:hidden property="checkNum" />
								
								<tr>
									<td nowrap align="right">主题：</td>
									<td><html:text property="s_title"/></td>
									<td nowrap align="right">开始时间：</td>
									<td>
									<html:text property="s_Date" onfocus="showCalendar(this)" readonly="true" styleClass="text" />
									
									</td>
									<td nowrap align="right">结束时间：</td>
									<td>
									<html:text  property="e_Date" onfocus="showCalendar(this)" readonly="true" styleClass="text" />
									
									</td>
									
									<td align="right">
									    <input type="button" value="查询" class="input3" onclick="submitInfo()" class="input3">
									    <input type="button" value="清空" class="input3" onclick="refresh(this.form)">
									    <input type='hidden' name="s_status" id="s_status" value="${status}">
									</td>
								</tr>

							</html:form>
						</table>
					</li>
				</ul>
			</div>
			<!-- 操作反馈信息 -->
			<%@ include file="/commons/messages.jsp" %>
			<!--列表-->
			<div class="myinfo myinfo3 tophei">
				<ul>
					<li class="tag">
						&nbsp;
						<img src="${templateVo.styleImagePath}/tag17.gif" />
						&nbsp;
					</li>
					<li>
						<b>${urlName3}列表</b>
					</li>
				</ul>
			</div>
			<!--  
			<div class="listtag">
				<table width="99%" border="0" cellspacing="0" cellpadding="0"
					align="center">
					<tr height="30">
						<td valign="bottom" align="left">
							
							<myTag:img name="BACKLOG_NEW_BTN"
								styleClass="xj" value="新建" onClick="Action('new', '${ctx}/BacklogAction.do')" />
							<myTag:img name="BACKLOG_EDIT_BTN"
								styleClass="xj1" value="修改" onClick="Action('edit', '${ctx}/BacklogAction.do')" />
							
						</td>
						<td align="left">
							<myTag:link name="BACKLOG_VIEW_BTN" onClick="otherAction('view')"
								picPath="${templateVo.styleImagePath}/list6.gif" value="查看" />
							
							<myTag:link name="BACKLOG_DEL_BTN" onClick="Action('del', '${ctx}/BacklogAction.do')"
								picPath="${templateVo.styleImagePath}/list4.gif" value="删除" />
							
						</td>
					</tr>
				</table>
			</div>
			-->
			<ec:table items="list" var="e" action="${ctx}/BacklogAction.do?method=list&s_status=${status}&e_Date=${eDate}&s_Date=${sDate}"
				retrieveRowsCallback="limit">
				
				<ec:row>
				
					<ec:column property="rowcount" cell="rowCount" sortable="false" title="编号" width="4%"/>
					
					<ec:column property="title" title="主题">
					<a  href="javascript:void(this.location='${ctx}${e.url}&reback=2&backlogId=${e.id}&status=${status}')">${e.title }</a>
					</ec:column>
					<ec:column property="status" title="状态" width="10%">
				        <c:if test="${e.status==10}" >
						  <font color="green">待办</font>
						</c:if>
						<c:if test="${e.status==11}" >
						   已办
						</c:if>
						<c:if test="${ (!fn:contains(e.readtime, userId) && e.type=='0') || e.status==20}" >
						  <font color="green">待阅</font>
						</c:if>
						<c:if test="${ (fn:contains(e.readtime, userId) && e.type=='0') || e.status==21 }" >
						   已阅
						</c:if>
					</ec:column>
					<ec:column property="sendName" title="发起人" width="15%"/>
					<ec:column property="sendDate" title="发送时间" cell="date" width="10%"/>
				</ec:row>
			</ec:table>
		</div>
	</body>
</html>
